<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html >
<html lang="en">
<head>
<%@include file="../../common/includeBaseSet.jsp" %>
<%@include file="../../common/includeSystemSet.jsp" %>
<%@include file="../../../common/operation_forbid.jsp" %>
<%@include file="../../../common/jsVersion.jsp" %>
</head>
<body>
	<div class="page-content">
		    <div class="col-xs-12 panel panel-success" style="height:90%"> 
	         	<div class="col-xs-6" style="width:100%">
	         	    <div class="form-group" style="text-align:center;margin-top: 3%">
						<label class="col-xs-2 control-label" style="width:95%;">
						          【${projectName}】项目复制其他项目设置的选项
						</label>
				     </div>
				     <div class="form-group" style="text-align:center;margin-top: 13%"">
						<label class="col-xs-2 control-label" style="width:30%;margin-left:9%">复制选项来源:</label>
						<select name="copyPid" id="copyPid" style="width:45%;margin-right:15%">
						     <c:forEach items="${projectList}" var="list">
							     <option value="${list.id}">${list.projectName}</option>
						     </c:forEach>
						</select>
				     </div>
				     <div id="btnDiv" class="form-group" style="margin-top:10px;text-align:center;">
						<button type="button" onclick="isSubmit()" class="btn btn-default">确定</button>
						<button type="button" onclick="" class="btn btn-link">取消</button>
				     </div>
				 </div>
		    </div>
	</div>	
</body>
<script type="text/javascript">
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	
	function isSubmit(){
		layer.confirm('是否确认使用当前选择项目的业务参数', {
		    btn: ['确定','取消'] //按钮
		}, function(){
			layer.closeAll('dialog');
			copyBaseCode();
		});
	}
	
	function copyBaseCode(){
		document.getElementById("btnDiv").style.display="none";
		layer.load(0, {shade: false}); //弹出加载层
		var copyPid = $("#copyPid").val();
		$.ajax({
            type: 'post',
            url: '${jypath}/system/baseCodeValue/copyBaseCode',
            data:{
                "projectId": "${projectId}",
                "copyPid": copyPid
            },
            dataType: 'json',
            success: function(data){
                layer.closeAll('loading'); //关闭加载层
                if(data.res == "1"){
                    layer.msg("复制业务参数成功");
                    parent.loadProjectList();
                    parent.layer.close(index);
                }else{
                	document.getElementById("btnDiv").style.display="block";
                    layer.msg(data.resMsg);
                }
            }
        });
	}
	
	
</script>
</html>